; -*-MIDAS-*-
;;; Copyright (c) 1999 Massachusetts Institute of Technology
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation; either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, see https://gnu.org/licenses or
;;; write to:
;;;  Free Software Foundatiom, Inc.
;;;  51 Franklin St, Fifth Floor
;;;  Boston, MA 02110-1301
;;;  USA


;;; ITS BITS THAT ARE OFTEN NEEDED

.AUXIL

;;; CATALOGUE OF RESERVED BIT NAME AND CONSTANT PREFIXES IN ITS

.SEE %CA	;BITS IN CLRAC FOR CORE LINK DEVICE
.SEE %CB	;BITS FOR CORBLK SYMBOLIC SYSTEM CALL
.SEE %CL	;.CALL ARGUMENT TYPES.
.SEE %CLS	;BITS IN LH OF CLSTB ENTRY
.SEE %DC	;DTE20 IOELEVEN COMMANDS
.SEE %DF	;T-300 FAULT (DSCFLT)
.SEE %DM	;T-300 COMMAND (DSCCMD)
.SEE %DO	;DSK OPEN MODE BITS
.SEE %DP	;DATAPOINT CURSOR CONTROL CONSTANTS
.SEE %DS	;T-300 STATUS (DSCSTS)
.SEE %DT	;DTE20 COMMANDS BITS AND CONSTANTS
.SEE %DV	;BITS IN DEVTAB
.SEE %E		;.CALL AND OPEN ERROR CODES
.SEE %GO	;SUPDUP GRAPHICS PROTOCOL COMMANDS
.SEE %H1	;RP04 (RH10/RH11) ERROR REGISTER 1
.SEE %H3	;RP04 (RH10/RH11) ERROR REGISTER 3
.SEE %HA	;RP04 (RH10/RH11) ADDRESS REGISTER
.SEE %HC	;RP04 (RH10) CONTROL REGISTER
.SEE %HD	;RH10 ERROR BITS IN DRIVE REGISTERS
.SEE %HI	;RH10 CONI BITS
.SEE %HM	;RP04 (RH10/RH11) COMMAND CONSTANTS
.SEE %HO	;RH10 CONO BITS
.SEE %HR	;RH10 CONTROLLER AND RP04 DRIVE REGISTER NUMBERS
		; OR RH11 UNIBUS REGISTER ADDRESSES
.SEE %HS	;RP04 (RH10/RH11) STATUS REGISTER BITS
.SEE %HW	;FOR KL AND KS, BITS IN RH OF RESULT OF APRID
.SEE %HX	;RH11 BITS IN %HRCS1
.SEE %HY	;RH11 BITS IN %HRCS2
.SEE %IL	;Interlan NI1010 bits and constants
.SEE %IOT	;BITS IN IOTTB
.SEE %IR	;BITS IN IP ROUTE ENTRY FLAGS
.SEE %JB	;BITS IN JBWST VARIABLE
.SEE %JG	;BITS IN JOBGET FIRST VALUE
.SEE %JO	;OPCODES IN JOBGET FIRST VALUE
.SEE %JS	;SPECIAL VALUES FOR <JOB> SPECS
.SEE %KE	;BITS IN KS10 MEMORY STATUS REGISTER (KSECCS)
.SEE %LH	;BITS AND CONSTANTS FOR ACC LH/DH IMP INTERFACE (KS10)
.SEE %MA	;BITS IN MSRAC (MAGTAPE STATUS TABLE)
.SEE %NC	;NETWORK SOCKET CLOSE REASONS
.SEE %NE	;ETHERNET - constants and bits (%EN taken..)
.SEE %NO	;INTERNET - bits for TCPOPN system call
.SEE %NS	;NETWORK SOCKET STATES
.SEE %NT	;INTERNET - TCP channel states (almost = to %NS.  See also %NX)
.SEE %NX	;INTERNET - TCP connection close reasons (almost = to %NC)
.SEE %OP	;BITS IN LH OF .OPTION USER VARIABLE
.SEE %PC	;KA10 PC FLAGS
.SEE %PF	;KL10 AND KS10 PAGE FAIL WORD BITS (DEFINITIONS DIFFER
		; BETWEEN MACHINES)
.SEE %PI	;BITS IN PIRQC USER VARIABLE
.SEE %PJ	;BITS IN LH OF PIRQC USER VARIABLE
.SEE %PS	;KL10 AND KS10 PC FLAGS
.SEE %QA	;BITS IN QSRAC (DISK STATUS TABLE)
.SEE %QM	;DISK ACTION MODES IN RH OF QSRAC
.SEE %RL	;BITS FOR COMMANDS TO .REALT UUO
.SEE %SCV	;BITS IN SYSCVL TO CONTROL SYMBOLIC SYSTEM CALLS
.SEE %SS	;STY STATUS BITS IN STYSTS
.SEE %SW	;LH(USWST) BITS
.SEE %SY	;NAMES FOR SQUOZE FLAGS IN SYMBOL TABLES (NOT DEFINED IN ITS)
.SEE %TA	;BITS IN TTYSTA
.SEE %TB	;BITS IN TTYTBL USER VARIABLE
.SEE %TC	;BITS IN TTYCOM
.SEE %TD	;SOFTWARE TTY CURSOR CONTROL CODE CONSTANTS
.SEE %TF	;BITS IN TPFLAG
.SEE %TG	;BITS IN TTYST1 AND TTYST2
.SEE %TI	;BITS IN LEFT HALF OF TTY INPUT IOCHNM WORD
.SEE %TJ	;BITS IN LH OF TTY OPTPUT IOCHNM
.SEE %TM	;BITS AND CONSTANTS FOR TM03/RH11 TAPE CONTROLLER (KS10)
.SEE %TN	;CONSTANTS FOR TCTYP
.SEE %TO	;BITS IN LEFT HALF OF TTYOPT
.SEE %TP	;BITS IN RIGHT HALF OF TTYOPT
.SEE %TQ	;BITS IN LEFT HALF OF TTYSMT
.SEE %TR	;BITS IN RIGHT HALF OF TTYSMT
.SEE %TS	;BITS IN TTYSTS
.SEE %TT	;BITS IN LEFT HALF OF TTYTYP
.SEE %TX	;ASCII CHARACTER BITS (META, TOP, CONTROL, ETC.)
.SEE %TY	;BITS IN RIGHT HALF OF TTYTYP
.SEE %UB	;BITS IS KS10 UNIBUS STATUS REGISTER (UBASTA)
.SEE %UC	;FOR KL AND KS, BITS IN LH OF RESULT OF APRID
.SEE %UM	;BITS IN UMAPS VARIABLE, AND ARGS TO PGLD, MPLD1, PLD1.
.SEE %UP	;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS READ) (UBAPAG)
.SEE %UQ	;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS WRITTEN) (UBAPAG)
.SEE %UST	;BITS IN USTP VARIABLE.
.SEE %WY	;WHYINT CODES
.SEE $11	;BYTE POINTERS TO PDP11 FIELDS IN PDP-10 WORDS, ON AI-KA
		;10-11 INTERFACE.
.SEE ..R	;ARGUMENT CODES FOR .BREAK 12, READING.
.SEE ..S	;ARGUMENT CODES FOR .BREAK 12, WRITING.
.SEE .XC	;INTERNET - TCP connection close reasons (almost = to %NC)
		; (Old names.  Use %NX instead.)

.SEE MMP	;BITS IN MMP ENTRY 1ST WORD L.H.
.SEE OPTTRP	;BITS IN LH OF .OPTION VARIABLE
		; (Old names.  Use %OP instead)
.SEE SCL	;BITS IN LH OF SUPCOR
.SEE SCR	;BITS IN RH OF SUPCOR

IFNDEF DEFSYM,[	;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES.
		;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK.
DEFINE DEFSYM X/
IRPS Z,,[X]
IFNDEF Z,.QUOTE/.QUOTE/X
.ELSE [
   $$TEM1==Z
   .QUOTE/.QUOTE/X
   IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/`
]
.ISTOP
TERMIN TERMIN

IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1.
.MLLIT==1
$$TEMP==1
]
.ELSE $$TEMP==0

;OPEN-FAILURE CODE NAMES.
;3RD AND 4TH LETTER: "TM" = "TOO MANY", "BD" = "BAD OR ILLEGAL",
;	"TF" = "TOO FEW", "RO" = "READ-ONLY", "NA" = "NOT AVAILABLE",
;	"NS" = "NO SUCH", "EX" = "ALREADY EXISTS", "FL" = "FULL",
;	"NR" = "NOT READY".
;5TH AND 6TH LETTER: "JB" = "JOB", "RG" = "ARG", "DV" = "DEVICE",
;	"DR" = "DIRECTORY", "IO" = "DIRECTION", "FL" = "FILE",
;	"FN" = "FILE NAME"
DEFSYM	%E==:-100			;BIT TYPEOUT MASK
DEFSYM	%ENSDV==:1	;NO SUCH DEVICE
DEFSYM	%ENSIO==:2	;WRONG DIRECTION
DEFSYM	%ETMTR==:3	;TOO MANY TRANSLATIONS
DEFSYM	%ENSFL==:4	;FILE NOT FOUND
DEFSYM	%EFLDR==:5	;DIRECTORY FULL
DEFSYM	%EFLDV==:6	;DEVICE FULL
DEFSYM	%ENRDV==:7	;DEVICE NOT READY
DEFSYM	%ENADV==:10	;DEVICE NOT AVAILABLE
DEFSYM	%EBDFN==:11	;ILLEGAL FILE NAME
DEFSYM	%ENSMD==:12	;MODE NOT AVAILABLE
DEFSYM	%EEXFL==:13	;FILE ALREADY EXISTS
DEFSYM	%EBDCH==:14	;BAD CHANNEL NUMBER
DEFSYM	%ETMRG==:15	;TOO MANY ARGUMENTS (CALL)
DEFSYM	%ENAPK==:16	;PACK NOT MOUNTED
	       ;17 FORMERLY DIRECTORY NOT AVAIL
DEFSYM	%ENSDR==:20	;NON-EXISTENT DIRECTORY
DEFSYM	%ELCDV==:21	;LOCAL DEVICE ONLY
DEFSYM	%ESCO==: 22	;SELF-CONTRADICTORY OPEN
DEFSYM	%ENAFL==:23	;FILE LOCKED
DEFSYM	%ETMDR==:24	;M.F.D. FULL
DEFSYM	%EMCHN==:25	;DEVICE NOT ASSIGNABLE TO THIS PROCESSOR
DEFSYM	%ERODV==:26	;DEVICE WRITE-LOCKED
DEFSYM	%ETMLK==:27	;LINK DEPTH EXCEEDED
DEFSYM	%ETFRG==:30	;TOO FEW ARGUMENTS (CALL)
DEFSYM	%EROJB==:31	;CAN'T MODIFY JOB
DEFSYM	%EROPG==:32	;CAN'T GET THAT ACCESS TO PAGE
DEFSYM	%EBDRG==:33	;MEANINGLESS ARGS
DEFSYM	%EBDDV==:34	;WRONG TYPE DEVICE
DEFSYM	%ENSJB==:35	;NO SUCH JOB
DEFSYM	%EBOJ==: 36	;VALID CLEAR OR STORED SET
DEFSYM	%ENACR==:37	;NO CORE AVAILABLE
DEFSYM	%ETOP==: 40	;NOT TOP LEVEL
DEFSYM	%ENAPP==:41	;OTHER END OF PIPELINE GONE OR NOT OPEN
DEFSYM	%ENAJB==:42	;JOB GONE OR GOING AWAY
DEFSYM	%ENSCL==:43	;ILLEGAL SYSTEM CALL NAME
DEFSYM	%ENSCH==:44	;CHANNEL NOT OPEN
DEFSYM	%ENRBF==:45	;INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL
DEFSYM	%EBDFL==:46	;UNRECOGNIZABLE FILE (LOAD)
DEFSYM	%EBDLK==:47	;LINK TO NON-EXISTENT FILE

NOPNLS==:47	;NO DEFSYM BECAUSE THIS SYMBOL IS NOT TO BE PREDEFINED TO USERS

; BITS IN .PIRQC USER VARIABLE - FIRST-WORD INTERRUPTS
; CLASSES ARE:
;  [1] STOPS JOB AND INTERRUPTS SUPERIOR (FATAL INTR)
;  [2] STOPS JOB AND INTERRUPTS SUPERIOR UNLESS ENABLED
;  [3] DOES NOTHING UNLESS ENABLED
; BITS IN THE LH HAVE TWO NAMES: %PI... AS A BIT IN THE WORD,
;  AND %PJ... SHIFTED DOWN BY 18. BITS.

.SEE PIRQC

DEFSYM	%PI==:525252,,525252		;FOR BIT-TYPEOUT MODE
DEFSYM	%PIRLT==:200000,,	;REAL-TIME TIMER WENT OFF	[3]
DEFSYM	%PIRUN==:100000,,	;RUN-TIME TIMER WENT OFF	[3]
DEFSYM	%PINXI==:40000,,	;NON-EX IO REG (KS10 UNIBUS)	[2]
DEFSYM	%PIJST==:20000,,	;JOB STATUS DISPLAY REQUEST     [3]
DEFSYM	%PIDCL==:10000,,	;DEFERRED CALL			[1]
DEFSYM	%PIATY==:4000,,		;WAS JUST GIVEN THE TTY		[3]
DEFSYM	%PITTY==:2000,,		;DON'T HAVE TTY (SEE %TBINT)	[2]
DEFSYM	%PIPAR==:1000,,		;MEMORY PARITY ERROR		[2]
DEFSYM	%PIFOV==:400,,		;FLOATING OVERFLOW		[3]
DEFSYM	%PIWRO==:200,,		;WRITE IN READ-ONLY PAGE	[2]
DEFSYM	%PIFET==:100,,		;FETCHED INSN FROM IMPURE PAGE	[2]
DEFSYM	%PITRP==:40,,		;SYSTEM UUO IN TRAP MODE	[1]
DEFSYM	%PIDBG==:2,,		;SYSTEM BEING DEBUGGED STATE CHG[3]
DEFSYM	%PILOS==:1,,		;.LOSE INSTRUCTION EXECUTED	[2]
DEFSYM	%PICLI==:400000		;CLI DEVICE OPENED TO THIS JOB	[3]
DEFSYM	%PIPDL==:200000		;PUSHDOWN LIST OVERFLOW		[3]
DEFSYM	%PILTP==:100000		;LIGHT PEN			[3]
DEFSYM	%PIMAR==:40000		;MAR ADDRESS TRAP		[2]
DEFSYM	%PIMPV==:20000		;MEMORY PROTECTION VIOLATION	[2]
DEFSYM	%PICLK==:10000		;SLOW (1/2 SEC) CLOCK		[3]
DEFSYM	%PI1PR==:4000		;SINGLE-INSTRUCTION PROCEED	[1]
DEFSYM	%PIBRK==:2000		;.BREAK INSTRUCTION EXECUTED	[1]
DEFSYM	%PIOOB==:1000		;ADDRESS OUT OF BOUNDS		[2]
DEFSYM	%PIIOC==:400		;I/O CHANNEL ERROR		[2]
DEFSYM	%PIVAL==:200		;.VALUE INSTRUCTION EXECUTED	[1]
DEFSYM	%PIDWN==:100		;SYSTEM GOING DOWN STATUS CHANGE[3]
DEFSYM	%PIILO==:40		;ILLEGAL OPERATION (E.G. UUO)   [2]
DEFSYM	%PIDIS==:20		;DISPLAY MEMORY PROTECT		[2]
DEFSYM	%PIARO==:10		;ARITHMETIC OVERFLOW		[3]
DEFSYM	%PIB42==:4		;BAD LOCATION 42		[1]
DEFSYM	%PIC.Z==:2		;^Z OR CALL TYPED		[1]
DEFSYM	%PITYI==:1		;TTY INPUT (OBSOLETE)		[3]

DEFSYM	%PJ==:1,,525252			;BIT TYPEOUT MASK
DEFSYM	%PJRLT==:200000		;REAL-TIME TIMER WENT OFF	[3]
DEFSYM	%PJRUN==:100000		;RUN-TIME TIMER WENT OFF	[3]
DEFSYM	%PJNXI==:40000		;NON-EX IO REG (KS10 UNIBUS)	[2]
DEFSYM	%PJJST==:20000		;JOB STATUS DISPLAY REQUEST     [3]
DEFSYM	%PJDCL==:10000		;DEFERRED CALL			[1]
DEFSYM	%PJATY==:4000		;WAS JUST GIVEN THE TTY		[3]
DEFSYM	%PJTTY==:2000		;DON'T HAVE TTY (SEE %TBINT)	[2]
DEFSYM	%PJPAR==:1000		;MEMORY PARITY ERROR		[2]
DEFSYM	%PJFOV==:400		;FLOATING OVERFLOW		[3]
DEFSYM	%PJWRO==:200		;WRITE IN READ-ONLY PAGE	[2]
DEFSYM	%PJFET==:100		;FETCHED INSN FROM IMPURE PAGE	[2]
DEFSYM	%PJTRP==:40		;SYSTEM UUO IN TRAP MODE	[1]
DEFSYM	%PJDBG==:2		;SYSTEM BEING DEBUGGED STATE CHG[3]
DEFSYM	%PJLOS==:1		;.LOSE INSTRUCTION EXECUTED	[2]

;;; PC FLAGS (LEFT HALF)

DEFSYM	%PC==:1,,525240		;FOR BIT-TYPEOUT MODE
DEFSYM	%PCARO==:400000		;ARITHMETIC OVERFLOW
DEFSYM	%PCCR0==:200000		;CARRY OUT OF BIT 0
DEFSYM	%PCCR1==:100000		;CARRY OUT OF BIT 1
DEFSYM	%PCFOV==:040000		;FLOATING OVERFLOW
DEFSYM	%PCFPD==:020000		;FIRST PART DONE
				; (E.G. ILDB PTR INCREMENTED, BYTE NOT FETCHED)
DEFSYM	%PCUSR==:010000		;USER MODE
DEFSYM	%PCUIO==:004000		;USER I/O
DEFSYM	%PCPUR==:002000		;GIVE %PIFET IF FETCH INSTR FROM WRITABLE
				; PAGE (KA-10 ONLY)
DEFSYM	%PCSPC==:001000		;"SPECIAL" - OBSOLETE
DEFSYM	%PC1PR==:000400		;1 PROCEED - GIVE %PI1PR AFTER ONE INSTRUCTION
DEFSYM	%PCX17==:000200		;XR 17 = PC (AI-KA ONLY)
DEFSYM	%PCFXU==:000100		;FLOATING EXPONENT UNDERFLOW
DEFSYM	%PCDIV==:000040		;DIVIDE ERROR

;;; PC FLAGS FOR KL-10 AND KS-10

DEFSYM	%PS==:1,,525240		;FOR BIT-TYPEOUT MODE
DEFSYM	%PSARO==:400000		;ARITHMETIC OVERFLOW
DEFSYM	%PSPCP==:400000		;PREVIOUS CONTEXT PUBLIC - PXCT CAN'T
				;REFERENCE CONCEALED PAGE THIS APPLIES ONLY
				;IN EXEC MODE.  IN USER MODE AND ON KS IS
				;STILL %PSARO.
DEFSYM	%PSCR0==:200000		;CARRY OUT OF BIT 0
DEFSYM	%PSCR1==:100000		;CARRY OUT OF BIT 1
DEFSYM	%PSFOV==:040000		;FLOATING OVERFLOW
DEFSYM	%PSFPD==:020000		;FIRST PART DONE (E.G. ILDB PTR
				;INCREMENTED, BYTE NOT FETCHED)
DEFSYM	%PSUSR==:010000		;USER MODE   ;	0	0	1	1
DEFSYM	%PSUIO==:004000		;USER I/O    ;;	KERNEL	SUPERV	CONCEAL	PUBLIC
DEFSYM	%PSPUB==:002000		;PUBLIC MODE ;	0	1	0	1
				;%PSPUB ALWAYS 0 ON KS.
DEFSYM	%PSPCU==:004000		;IN EXEC MODE %PSUIO MEANS PREVIOUS CONTEXT
				;USER.
DEFSYM	%PSINH==:001000		;INHIBIT ADDRESS BREAK & TRAP 3 (TURNS OFF
				;AFTER 1 INST)  %PSINH ALWAYS 0 ON KS.
DEFSYM	%PSTR2==:000400		;TRAP 2 (PDL OVERFLOW)	    ;TRAP 1 PLUS TRAP 2
DEFSYM	%PSTR1==:000200		;TRAP 1 (ARITH OVERFLOW)    ; MAKES TRAP 3
							    ; (ONE PROCEED
							    ; ON KL) 
DEFSYM	%PSFXU==:000100		;FLOATING EXPONENT UNDERFLOW
DEFSYM	%PSDIV==:000040		;DIVIDE ERROR

DEFSYM	%PS1PR==:001600		;BITS TO SET TO CAUSE A 1-PROCEED ON KL.

; INTERNET and ARPANET

.SEE NETRFC
DEFSYM	%NQ==:1,,525252	; Control bits for NETRFC system call
DEFSYM	%NQREF==:1	; Refuse this connection request.  Arg 2 must be a
			; previously returned RFC identifier.

.SEE TCPOPN
DEFSYM	%NO==:1,,525252	; Control bits for TCPOPN system call
DEFSYM	%NOLSN==:100	; Listen mode - wait for SYN (request for conn)

DEFSYM	%NS==:,-1	; NCP (old ARPANET) SOCKET STATES
DEFSYM	%NSCLS==:0	;CLS RECEIVED.  CONNECTION CLOSED (IMSCLS GIVES REASON)
DEFSYM	%NSLSN==:1	;LISTENING FOR RFC
DEFSYM	%NSRFC==:2	;RFC RECEIVED WHILE IN LISTENING STATE
DEFSYM	%NSRCL==:3	;CLS RECEIVED WHILE IN RFC RECEIVED STATE
DEFSYM	%NSRFS==:4	;RFC SENT
DEFSYM	%NSOPN==:5	;CONNECTION OPEN
DEFSYM	%NSRFN==:6	;RFNM WAIT ON WRITE LINK
DEFSYM	%NSCLW==:7	;CLS SENT.  WAITING FOR MATCHING CLS
DEFSYM	%NSCLI==:10	;CLS RECEIVED BUT INPUT STILL AVAILABLE
DEFSYM	%NSINP==:11	;INPUT AVAILABLE

DEFSYM	%NT==:,,-1	; TCP port states as seen by user
	; Legend: - Pre-Open, * Open, + Post-open, ? impossible.
	;	I = can read, O = can write.
	; Note that the input and output channels for a TCP connection
	; will usually have different states.  Also, note that
	; for all practical purposes, %NT and %NS symbols with the same
	; value have the same meaning.  SYN = Request for connection.
			; In Out
DEFSYM	%NTCLS==:0	; -  -	Closed (reason available from WHYINT)
DEFSYM	%NTLSN==:1	; -  -	Listening for a SYN
DEFSYM	%NTSYR==:2	; -  -	SYN received
DEFSYM	%NTCLU==:3	; +  ?	Being closed by fgn host
DEFSYM	%NTSYN==:4	; -  -	SYN sent, waiting for response
DEFSYM	%NTOPN==:5	; *I *O	Open
DEFSYM	%NTWRT==:6	; ?  *O	Output buffer full
DEFSYM	%NTCLX==:7	; ?  +	Being closed by user
DEFSYM	%NTCLI==:10	; +I ?	Closing/closed, input still available
DEFSYM	%NTINP==:11	; *I ?	Open, input available


DEFSYM	%NC==:,-1	; NCP (old ARPANET) CLOSE REASONS (IN IMSCLS)
DEFSYM	%NCNTO==:0	;NEVER OPENED
DEFSYM	%NCUSR==:1	;CLSED BY USER
DEFSYM	%NCFRN==:2	;CLSED BY FOREIGN HOST
DEFSYM	%NCRST==:3	;RST
DEFSYM	%NCDED==:4	;HOST DEAD
DEFSYM	%NCINC==:5	;INCOMPLETE TRANSMISSION
DEFSYM	%NCBYT==:6	;BYTE SIZE MISMATCH.
DEFSYM	%NCNCP==:7	;OUR NCP WENT DOWN.
DEFSYM	%NCRFS==:10	;REQUEST FOR CONNECTION REFUSED

;;; .XC is being phased out for the name %NX instead.
;;; The .XC symbols will be flushed "soon".

DEFSYM	.XC==,,-1	; TCP port cls reasons (valid for ALL post-open states)
			; Note .XC and %NC symbols with the same value
			; have pretty much the same meanings.
DEFSYM	.XCNTO==:0	; Never opened
DEFSYM	.XCUSR==:1	; Closed by user
DEFSYM	.XCFRN==:2	; Closed by foreign host
DEFSYM	.XCRST==:3	; Fgn host refused or aborted connection.
DEFSYM	.XCDED==:4	; Fgn host dead (not used yet)
DEFSYM	.XCINC==:5	; Incomplete transmission (retransmission timeout)
			; This is the usual indication when a foreign host
			; or the intervening network crashes.
	;     ==:6	; Byte size mismatch - can't happen
DEFSYM	.XCNCP==:7	; Local TCP went down (not used yet)
DEFSYM	.XCRFS==:10	; RST received while in SYN-SENT state.
			; (foreign host refused connection)

DEFSYM	%NX==,,-1	; TCP port cls reasons (valid for ALL post-open states)
			; Note %NX and %NC symbols with the same value
			; have pretty much the same meanings.
DEFSYM	%NXNTO==:0	; Never opened
DEFSYM	%NXUSR==:1	; Closed by user
DEFSYM	%NXFRN==:2	; Closed by foreign host
DEFSYM	%NXRST==:3	; Fgn host refused or aborted connection.
DEFSYM	%NXDED==:4	; Fgn host dead (not used yet)
DEFSYM	%NXINC==:5	; Incomplete transmission (retransmission timeout)
			; This is the usual indication when a foreign host
			; or the intervening network crashes.
	;     ==:6	; Byte size mismatch - can't happen
DEFSYM	%NXNCP==:7	; Local TCP went down (not used yet)
DEFSYM	%NXRFS==:10	; RST received while in SYN-SENT state.
			; (foreign host refused connection)



;;; BITS IN RESULT OF APRID (BLKI APR,) ON KL-10 AND KS-10
DEFSYM	%UC==:1,,525000		;FOR BIT-TYPEOUT MODE
DEFSYM	$UCOPT==:331100		;MICROCODE OPTIONS:
DEFSYM	%UCKLP==:400000		; KL-10-STYLE PAGING
DEFSYM	%UCITS==:20000		; ITS-STYLE PAGING
DEFSYM	%UCTRK==:1000		; TRACKS FEATURE
DEFSYM	$UCVRS==:221100		;MICROCODE VERSION NUMBER
DEFSYM	%UCVRS==:1
DEFSYM	%HW==:0,,527777		;FOR BIT-TYPEOUT MODE
DEFSYM	$HWOPT==:140600		;HARDWARE OPTIONS
DEFSYM	$HWSER==:001400		;PROCESSOR SERIAL NUMBER


;;; .CALL ARGUMENT TYPES
DEFSYM	%CL==:1,,400777
DEFSYM	%CLIN==:0		;INPUT ARGUMENT
DEFSYM	%CLIMM==:1000		;IMMEDIATE ARGUMENT
DEFSYM	%CLOUT==:2000		;OUTPUT ARGUMENT
DEFSYM	%CLERR==:3000		;ERROR CODE OUTPUT ARGUMENT
DEFSYM	%CLBTW==:4000		;DIRECT CONTROL BITS
DEFSYM	%CLBIT==:5000		;IMMEDIATE CONTROL BITS


;;; CONTROL BITS FOR CORBLK SYSTEM CALL

.SEE NCORBLK
DEFSYM	%CB==:0,,525252			;FOR BIT-TYPEOUT MODE
DEFSYM	%CBWRT==:400000		;TRY FOR WRITE ACCESS, OK IF CAN'T GET IT
DEFSYM	%CBRED==:200000		;TRY FOR READ ACCESS, OK IF CAN'T GET IT
DEFSYM	%CBNDW==:100000		;NEED WRITE ACCESS, FAIL IF CAN'T GET IT
DEFSYM	%CBPUB==:040000		;MAKE PAGE PUBLIC, REQUIRES WRITE ACCESS
DEFSYM	%CBPRV==:020000		;MAKE PAGE PRIVATE, REQUIRES WRITE ACCESS
DEFSYM	%CBNDR==:010000		;NEED READ ACCESS, FAIL IF CAN'T GET IT
DEFSYM	%CBCPY==:004000		;MAKE A COPY (DISK FILES ONLY)
DEFSYM	%CBLOK==:002000		;LOCK PAGE IN CORE.
DEFSYM	%CBULK==:001000		;UNLOCK PAGE (ALLOW SWAP-OUT)
DEFSYM	%CBSLO==:000400		;MAY ONLY RESIDE IN SLOWEST MEMORY
DEFSYM	%CBUSL==:000200		;ALLOWS USE OF ANY MEMORY.
		;ABOVE BITS ALL ZERO MEANS DELETE PAGE FROM MAP

;;; SPECIAL VALUES FOR <JOB> SPECS

DEFSYM	%JS==:,,-1
DEFSYM	%JSELF==:,,-1		;SELF (ALL <JOB> SPECS)
DEFSYM	%JSTVB==:,,-2		;11TV BUFFER (CORBLK)
DEFSYM	%JSNUL==:,,-3		;NULL JOB (KLPERF)
DEFSYM	%JSALL==:,,-4		;ALL JOBS (KLPERF)
DEFSYM	%JSNEW==:,,-5		;FRESH PAGE (CORBLK)
DEFSYM	%JSABS==:,,-6		;ABSOLUTE CORE (CORBLK)
DEFSYM	%JSNUM==:400000		;THIS + JOB # => THAT JOB (ALL <JOB> SPECS)
DEFSYM	%JSSIX==:400376		;PDP6 IS USER NUMBER 376
DEFSYM	%JSSUP==:400377		;SUPERIOR (ALL <JOB> SPECS)
;A <JOB> SPEC MAY ALSO BE THE NUMBER OF A CHANNEL OPEN ON USR:, BOJ:, OR STY:

;;; CONTROL BITS FOR ".REALT AC," UUO.
;;; FLAG BITS ARE IN LH(AC).

.SEE AREALT
DEFSYM	%RL==:1,,525252		;FOR BIT-TYPEOUT MODE
DEFSYM	%RLFLS==:400000		;FLUSH OLD TIMER
DEFSYM	%RLSET==:200000		;SET NEW CLOCK RATE
DEFSYM	%RLUSR==:100000		;TRY TO SEIZE REAL TIME USER FACILITY
DEFSYM	%RLPSD==:020000		;ONLY WANT PSEUDO REAL TIME
DEFSYM	%RLNPS==:040000		;CANNOT ACCEPT PSEUDO REAL TIME
DEFSYM	%RLBLK==:010000		;PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY
				; PHASE OR INTERRUPT LEVEL
DEFSYM	%RLGET==:004000		;GET PREVIOUS STATUS IN WORDS 3+4
				;REMAINING BITS MUST BE ZERO

;;; BITS OF .OPTION USER VARIABLE.

.SEE OPTION
DEFSYM	OPTTRP==:400000		;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP)
DEFSYM	OPTDEC==:100000		;UUOS 40,41 AND 47 ARE USER UUOS
		;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM.
		;THEY ARE FOR COMMUNICATION FROM SUPERIOR.
DEFSYM	OPTCMD==:040000		;SUPERIOR SAYS IT HAS CMD STRING - DO
				; .BREAK 12,.
DEFSYM	OPTBRK==:020000		;SUPERIOR SAYS IT HANDLES ALL .BREAK'S.
DEFSYM	OPTDDT==:010000		;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT
				; DISOWNS)
DEFSYM	OPTINT==:004000		;NEW STYLE VECTORING INTS.
DEFSYM	OPTOJB==:002000		;ALLOW OTHER JOBS TO OPEN ME ON THE OJB
				; DEVICE.  OPENING ME ON OJB DEVICE TURNS
				; ME INTO A JOB DEVICE.
DEFSYM	OPTLOK==:001000		;ENABLE SWITCH-UNLOCKING FEATURE
		.SEE IODCSW	; SEE COMMENT THERE FOR DESCRIPTION.
DEFSYM	OPTLIV==:000400		;DON'T KILL THIS TOP LEVEL JOB WHEN SYS
				; GOES DOWN.
DEFSYM	OPTOPC==:000200		;INTERRUPTS THAT ABORT AN INSTRUCTION
				; SHOULD LEAVE THE PC POINTING TO THAT
				; INSTRUCTION (OTHERWISE IT GETS AOS'ED)
DEFSYM	OPTLSP==:000100		;SUPERIOR SAYS HE'S LISP
DEFSYM	OPTLKF==:000040		;UNLOCK LOCKS ON FATAL INTERRUPT IN
		.SEE SYSDT	; TOP-LEVEL NON-DISOWNED JOB.

;;; NEW NAMES FOR BITS IN LH(.OPTION)

DEFSYM	%OP==:525252(1)		;FOR BIT-TYPEOUT MODE
DEFSYM	%OPTRP==:400000		;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP)
DEFSYM	%OPDEC==:100000		;UUOS 40,41 AND 47 ARE USER UUOS
		;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM.
		;THEY ARE FOR COMMUNICATION FROM SUPERIOR.
DEFSYM	%OPCMD==:040000		;SUPERIOR SAYS IT HAS CMD STRING - DO
				; .BREAK 12,.
DEFSYM	%OPBRK==:020000		;SUPERIOR SAYS IT HANDLES ALL .BREAK'S.
DEFSYM	%OPDDT==:010000		;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT
				; DISOWNS)
DEFSYM	%OPINT==:004000		;NEW STYLE VECTORING INTS.
DEFSYM	%OPOJB==:002000		;ALLOW OTHER JOBS TO OPEN ME ON THE OJB
				; DEVICE.  OPENING ME ON OJB DEVICE TURNS
				; ME INTO A JOB DEVICE.
DEFSYM	%OPLOK==:001000		;ENABLE SWITCH-UNLOCKING FEATURE
		.SEE IODCSW	; SEE COMMENT THERE FOR DESCRIPTION.
DEFSYM	%OPLIV==:000400		;DON'T KILL THIS TOP LEVEL JOB WHEN SYS
				; GOES DOWN.
DEFSYM	%OPOPC==:000200		;INTERRUPTS THAT ABORT AN INSTRUCTION
				; SHOULD LEAVE THE PC POINTING TO THAT
				; INSTRUCTION (OTHERWISE IT GETS AOS'ED)
DEFSYM	%OPLSP==:000100		;SUPERIOR SAYS HE'S LISP
DEFSYM	%OPLKF==:000040		;UNLOCK LOCKS ON FATAL INTERRUPT IN
		.SEE SYSDT	; TOP-LEVEL NON-DISOWNED JOB.

;;; LOSING ERROR CODES

DEFSYM	%LS==:777400		;RH OF .LOSE INSTRUCTION
DEFSYM	%LSINT==:1
DEFSYM	%LSSYS==:1000		;INTERPRET LAST OPEN LOSS CODE, USING .BCHN
DEFSYM	%LSFIL==:1400		; DO THAT AND PRINT FILE NAMES FROM CALL'S CHNL

;;; FIRST RESULT OF .CALL WHYINT

DEFSYM	%WY==:,-1
DEFSYM	%WYTYI==:1		;TTY INPUT
DEFSYM	%WYTYO==:2		;TTY OUTPUT
DEFSYM	%WYSTI==:3		;STY INPUT
DEFSYM	%WYSTO==:4		;STY OUTPUT
DEFSYM	%WYNET==:5		;ARPANET (NCP)
DEFSYM	%WYCHA==:6		;CHAOS NET
DEFSYM	%WYTCP==:7		;INTERNET (TCP)

;I/O MODES FOR OPENS.

DEFSYM	.UAI==0			;UNIT ASCII INPUT.
DEFSYM	.UAO==1			;UNIT ASCII OUTPUT.
DEFSYM	.BAI==2			;BLOCK ASCII INPUT.
DEFSYM	.BAO==3			;BLOCK ASCII OUTPUT.
DEFSYM	.UII==4			;UNIT IMAGE INPUT.
DEFSYM	.UIO==5			;UNIT IMAGE OUTPUT.
DEFSYM	.BII==6			;BLOCK IMAGE INPUT.
DEFSYM	.BIO==7			;BLOCK IMAGE OUTPUT.

;OPEN BITS FOR DEVICE DSK:

DEFSYM  %DO==1,,525252		;BIT TYPEOUT MASK
DEFSYM	%DOOUT==1
DEFSYM	%DOBLK==2
DEFSYM	%DOIMG==4
DEFSYM	%DONRF==10		;DON'T SET REFERENCE DATE.
DEFSYM	%DONLK==20		;DON'T CHASE LINKS.
DEFSYM	%DORWT==40		;ON OUTPUT OPEN, MAKES WOULD-BE READERS
				;WAIT TILL WE CLOSE.
DEFSYM	%DOWOV==100000		;WRITE OVER (USE WITH %DOOUT, TO OVERWRITE
				;EXISTING FILE). 

;ARGUMENT CODES FOR .BREAK 12,'S.
;..R AND ..S ARE BIT TYPEOUT MASKS, NOT MADE PREDEFINED TO MIDAS
;SINCE THEY ARE USEFUL ONLY IN DDT, WHICH DEFINES THEM ITSELF.

..R==0				;(FOR .SEE)
DEFSYM	..RSTART==1		;READ STARTING ADDRESS
DEFSYM	..RLFILE==2		;READ LOADED FILE'S NAMES
DEFSYM	..RSTP==3		;READ SYMBOL TABLE POINTER
DEFSYM	..RSYM==4		;READ VALUE OF SYMBOL.
DEFSYM	..RJCL==5		;READ JOB COMMAND LINE.
DEFSYM	..RPFILE==6		;READ :PRINT FILENAME DEFAULTS.
DEFSYM	..RSTB==7		;READ WHOLE SYMBOL TABLE.
DEFSYM	..RCONV==10		;READ NAME OF SYMBOL CLOSEST IN VALUE TO
				; ARGUMENT.
DEFSYM	..RLJB==13		;READ IDX OF PREVIOUSLY CURRENT JOB.
DEFSYM	..RRND==14		;READ RANDOM JOB-SPECIFIC BITS.
DEFSYM	..RPUR==15		;UNPURIFY PAGE
DEFSYM	..RHSNAME==16		;ASK SUPERIOR TO LOOKUP AN HSNAME FROM XUNAME
DEFSYM  ..RMAIL==17		;ASK A SUPERIOR TO LOOKUP USER'S MAIL FILE NAME

..S==0				;(FOR .SEE)
DEFSYM	..SSTART==400001	;SET STARTING ADDRESS
DEFSYM	..SLFILE==400002	;SET LOADED FILE'S NAMES
DEFSYM	..SSYM==400004		;SET VALUE OF SYMBOL.
DEFSYM	..SJCL==400005		;CLEAR JOB COMMAND LINE.
DEFSYM	..SPFILE==400006	;SET :PRINT FILENAME DEFAULTS.
DEFSYM	..SSTB==400007		;PASS WHOLE SYMBOL TABLE TO SUPERIOR.
DEFSYM	..SRND==400014		;SET RANDOM JOB-SPECIFIC BITS.
DEFSYM	..SPUR==400015		;SAME AS ..RPUR

;.CALL JOBGET
;ARG 1 - BOJ CHNL
;UP TO SIX WDS RETURNED
;WD1 BITS:
DEFSYM	%JG==:1,,525252
		;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT
		;    4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN
		;    WD7 ON AN OPEN
DEFSYM	%JGCLS==:40000	;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO)
DEFSYM	%JGSIO==:1000	;4.1 => SIOT (ONLY IF OPCODE = 1)
DEFSYM	%JGFPD==:200	;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING
;1.4-1.1 => TYPE OF OPERATION
DEFSYM	%JO==:,,-1
DEFSYM	%JOOPN==:0	;OPEN
DEFSYM	%JOIOT==:1	;IOT/SIOT
DEFSYM	%JOLNK==:2	;MLINK
DEFSYM	%JORST==:3	;RESET
DEFSYM	%JORCH==:4	;RCHST
DEFSYM	%JOACC==:5	;ACCESS
DEFSYM	%JORNM==:6	;FDELE (DELETE OR RENAME)
DEFSYM	%JORWO==:7	;FDELE (RENAME WHILE OPEN)
DEFSYM	%JOCAL==:10	;SYMBOLIC .CALL

;MODE BITS FOR TTY OPENS:
;3.1 0 -> IN 1 -> OUT
;3.2 0 -> UNIT 1 -> BLOCK

;OUTPUT
;3.3 => IMAGE MODE (SET ALL %TGIMG BITS IN TTYST1 AND TTYST2)
;3.4 0 -> NORMAL 1 -> ECHO MODE OUTPUT (SET %TJECH, %TJPP2, %TJMOR).
;3.5 0 -> NORMAL 1 -> DISPLAYMODE, LOOK FOR ^P (SET %TJDIS).
;3.6 0 -> NORMAL 1 -> SUPER-IMAGE OUTPUT (SET %TJSIO).
;OUTPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR
;%TJCNS, %TJCP1, AND %TJCP2

;INPUT
;3.3 => IMAGE MODE (CLEAR ALL ECHO BITS IN TTYST1, TTYST2).
;3.4 => "DDT" (DON'T ECHO CR, LF, TAB)
;3.6 => WANT 3 LINES IN ECHO AREA.
;INPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR %TICNS.

;BITS 3.4 AND 3.6 ON INPUT, AND BIT 3.3, HAVE EFFECT
;ONLY ON THE FIRST OPEN IN EITHER DIRECTION.
;(THEY ARE OBSOLETED BY THE TTYSET SYSTEM CALL)

;BITS IN LH OF A TTY CHANNEL IOCHNM WORD
;THESE BITS MAY BE TEMPORARILY COMPLEMENTED BY SPECIFYING
;THEM IN THE CONTROL-BIT ARGUMENT TO A SYMBOLIC IOT
;(EXCEPT FOR %TICNS AND $TIIDX).
DEFSYM	%TI==:1,,525277		;BIT TYPEOUT MASK
DEFSYM	%TJ==:1,,525277		;BIT TYPEOUT MASK

DEFSYM	%TICNS==:400000	;4.9 1-> CONSOLE 0 -> DEVICE
DEFSYM	%TJCNS==:400000	;4.9 1-> CONSOLE 0 -> DEVICE

;THE FOLLOWING INTERPRETATIONS OF BITS ARE FOR OUTPUT ONLY.
DEFSYM	%TJCP1==:200000	;^P-CODE ANTICIPATION STATE.
DEFSYM	%TJCP2==:100000	; ".  0=>NORMAL, 1=> CHAR AFTER ^P, 2=> ^PH, 3=>^PV.
DEFSYM	%TJECH==:40000	;SET => ECHO MODE OUTPUT.-MODE OUTPUT (ALL CHARS
			; OUTPUT THE WAY THEY WOULD BE ECHOED)
DEFSYM	%TJCTN==:20000	;SET => DON'T DO LINE-CONTINUATION.
DEFSYM	%TJSTP==:10000	;SET => THIS CHANNEL IS HUNG IN **MORE**.
DEFSYM	%TJDIS==:4000	;SET => LOOK FOR ^P CODES.
DEFSYM	%TJSIO==:2000	;SET => SUPERIMAGE OUTPUT, NO PADDING OR CURSOR CTL.
DEFSYM	%TJMOR==:1000	;SET => DON'T DO **MORE** PROCESSING.
DEFSYM	%TJPP2==:400	;SET => USE ALTERNATE PC PPR (THE ECHO AREA)
DEFSYM	%TJINK==:200	;SET => NEXT CHAR OUT TAKEN AS PRINTING
			; REGARDLESS (^PI)
DEFSYM	%TJHDE==:100	;SET => ACCOUTING FOR CURSOR MOTION DUE TO
			;CHAR ECHOED ON A HALF-DUPLEX TTY.

;INPUT
DEFSYM	%TIECH==:40000	;CAN READ EVEN IF CHAR NEEDS PI ECHOING.
DEFSYM	%TIPEK==:20000	;DON'T REMOVE CHAR FROM BUFFER.
DEFSYM	%TIACT==:4000	;SET => DON'T WAIT FOR ACTIVATION CHARACTER.
DEFSYM	%TIINT==:2000	;SET => CAN READ A CHAR EVEN IF IT IS SUPPOSED TO
			; INTERRUPT & HASN'T YET.
DEFSYM	%TINWT==:1000	;SET => IF NO INPUT AVAILABLE, DON'T WAIT, JUST
			; RETURN -1.
DEFSYM	%TIFUL==:400	;SET => GIVE FULL CHARACTER (SIGNIFICANT ON IMLAX, TVS)

DEFSYM	$TIIDX==:220600	;3.6-3.1 CONSOLE #, OR 77 FOR A "DISOWNED" CONSOLE
			; TTY CHNL, IE, ONE THAT CORRESPONDS TO NO REAL TTY.
			; THEY EXIST ONLY IN TREES WITH NO TTY, IN JOBS
			; THAT CAME FROM TREES WITH TTYS.
DEFSYM	%TIIDX==:1	;FOR BIT TYPEOUT MODE
DEFSYM	%TJIDX==:1	;FOR BIT TYPEOUT MODE
DEFSYM	%TINON==:77	;"TTY #" FOR A CHANNEL WITH NO REAL TTY.

;EACH CHARACTER IN THE INPUT BUFFER OCCUPIES 18 BITS
;THE UPPER BITS ARE AS FOLLOWS (NOTE THAT AN IOTTED
;CHARACTER MAY ACTUALLY CONTAIN %TXPIE, %TXMPE, %TXECI, OR %TXINT)
DEFSYM	%TX==:525200		;BIT TYPEOUT MASK
DEFSYM	%TXMPE==:400000	;MAIN PROGRAM ECHO CHARACTER
DEFSYM	%TXPIE==:200000	;PI ECHO CHARACTER
; DEFSYM %TXCOM==:100000	;COM MODE ECHO CHAR; DO PI ECHO EVEN IF HDX
; 			; TTY. 
; DEFSYM %TXIGN==:40000	;IGNORE THIS CHAR AT .IOT TIME.
; DEFSYM %TXACT==:20000	;THIS IS AN ACTIVATION CHAR.
; THESE CAN'T BE NEEDED EXCEPT INSIDE THE SYSTEM.
DEFSYM	%TXINT==:10000	;THIS CHAR SHOULD INTERRUPT THE USER.
;GAP
DEFSYM	%TXECI==:2000	;THIS CHAR WAS ECHOED BY AN ECHOIN SYSTEM CALL.

;NOW COME THE BITS OF THE CHARACTER ITSELF:
DEFSYM	%TXTOP==:4000	;The "TOP" key.
;GAP
DEFSYM	%TXSFT==:1000	;What used to be the "SHIFT" key is now the
DEFSYM	%TXSUP==:1000	;"SUPER" key. (def'ed in this order for DDT)
DEFSYM	%TXMTA==:400	;"META" key.
DEFSYM	%TXCTL==:200	;"CONTROL" key.
DEFSYM	%TXASC==:177	;The ASCII part of the character.

;DISPLAY COMMANDS (WHICH LIVE IN THE OUTPUT BUFFER).
;NOTE THAT ALL OF THEM HAVE 200-BIT SET.
DEFSYM	%TD==:777400
DEFSYM	%TDMOV==:200	;MOVE CURSOR
DEFSYM	%TDMV1==:201	;DUMMY COMMAND CREATED BY TYMOV.
			;MAKES IT POSSIBLE FOR TYMOV TO STOP WHEN BUFFER FULL
			;AND BE REENTERED NEXT INTERRUPT.
DEFSYM	%TDEOF==:202	;CLEAR REST OF PAGE
DEFSYM	%TDEOL==:203	;CLEAR REST OF LINE
DEFSYM	%TDDLF==:204	;DELETE FORWARD (FOR IMLACS AND TVS)
DEFSYM	%TDMTF==:205	;MOTOR OFF (FOR TERMINETS)
DEFSYM	%TDMTN==:206	;MOTOR ON (FOR TERMINETS)
DEFSYM	%TDCRL==:207	;CRLF ON DATAPOINTS, IMLACS.
DEFSYM	%TDNOP==:210	;NO-OP FOR SUPERDUPERIMAGE MODE.
DEFSYM	%TDBS==:211	;BACKSPACE (FOR TTY'S WITH %TORAW SET).
DEFSYM	%TDLF==:212	;LINEFEED (").
DEFSYM	%TDRCR==:213	;CARRET (").
DEFSYM	%TDORS==:214	;"OUTPUT RESET" FOR SAKE OF SOFTWARE TTYS
DEFSYM	%TDQOT==:215	;MYSTERY COMMAND -- SEND IN A JINGLE IN 25 WORDS OR
			; LESS AND WIN
DEFSYM	%TDFS==:216	;CURSOR FORWARD ONE COLUMN
DEFSYM	%TDMV0==:217	;MOVE CURSOR, FOLLOWED BY NEW VERT POS, NEW HOR POS
DEFSYM	%TDCLR==:220	;CLEAR THE SCREEN
DEFSYM	%TDBEL==:221	;DING THE BELL
DEFSYM	%TDINI==:222	;SYSTEM JUST CAME UP, RE-INITIALIZE INTELLIGENT
			; TERMINAL
DEFSYM	%TDILP==:223	;INSERT LINE-POSITION, FOLLOW BY COUNT
DEFSYM	%TDDLP==:224	;DELETE LINE-POSITION, FOLLOW BY COUNT
DEFSYM	%TDICP==:225	;INSERT CHARACTER-POSITION, FOLLOW BY COUNT
DEFSYM	%TDDCP==:226	;DELETE CHARACTER-POSITION, FOLLOW BY COUNT
DEFSYM	%TDBOW==:227	;ENTER BLACK ON WHITE MODE
DEFSYM	%TDRST==:230	;DESELECT ALL SPECIAL MODES (SUCH AS BLACK-ON-WHITE).
DEFSYM	%TDGRF==:231	;ENTER GRAPHICS MODE
DEFSYM	%TDRSU==:232	;REGION SCROLL UP
DEFSYM	%TDRSD==:233	;REGION SCROLL DOWN

; Apparently codes 234 - 237 are used for an undocumented kludge for
; sending ARDS graphics protocol.  See SYSENG;IMPRIN (the source of
; :ARDPRN).

;%TDSYN THROUGH %TDMLT ARE USED ONLY ON TERMINALS WHICH HAVE %TRLED SET IN
; TTYSMT.
DEFSYM  %TDSYN==:240	;RESYNCH REPLY TO LOCAL EDITING TERMINAL
DEFSYM	%TDECO==:241	;ASK TERMINAL TO TRY LOCAL EDITING BY SENDING A
			; RESYNCH.
DEFSYM	%TDEDF==:242	;SET LOCAL EDITING TERMINAL COMMAND DEFINITION.
			; FOLLOWED BY TWO BYTES, DECODED AS DESCRIBED IN
			; LOCAL EDITING PROTOCOL.
DEFSYM	%TDNLE==:243	;STOP DOING LOCAL EDITING.
DEFSYM	%TDTSP==:244	;DISPLAYS LIKE SPACE, BUT IS PART OF A TAB.  USED
			; ONLY FOR LOCAL EDITING TERMINALS, TO ENABLE THEM
			; DISTINGUISH SPACES FROM TABS.
DEFSYM	%TDCTB==:245	;THIS LINE IS CONTINUED AT THE BEGINNING.
DEFSYM	%TDCTE==:246	;THIS LINE IS CONTINUED AT THE END.
DEFSYM  %TDMLT==:247	;%TDMLT <N> => NEXT <N> COLS ARE DISPLAY REP FOR
			; ONE CHAR OF TEXT. 
;%TDSVL THROUGH %TDSLL ARE USED ON TERMINALS WHICH HAVE NONZERO %TRLSV.
DEFSYM	%TDSVL==:250	;<N> <L1> <L2> => SAVE <N> LINES' CONTENTS UNDER
			; LABELS STARTING WITH <L2>*200+<L1>.
DEFSYM	%TDRSL==:251	;SAME THREE ARGS.  RESTORE LABELED CONTENTS ONTO
			; <N> LINES.
DEFSYM	%TDSSR==:252	;<BEG> <END+1> SET RANGE OF COLUMNS TO COPY IN
			; %TDSVL, %TDRSL.
DEFSYM	%TDSLL==:253	;<L1> <L2> SET LABEL FOR NEXT LINE PUSHED OFF
			; SCREEN LOCALLY.
DEFSYM	%TDMAX==:254	;1 + LARGEST DISPLAY CODE.

;THE TCTYP WORD FOR A TTY CONTAINS A NUMBER WHICH SAYS HOW TO
;PERFORM CURSOR-CONTROL FUNCTIONS ON THE TTY. THE POSSIBILITIES ARE:
DEFSYM	%TN==:777777
DEFSYM	%TNPRT==:0	;PRINTING TTY.
DEFSYM	%TNDP==:1	;TTY USES DATAPOINT CURSOR CTL CODES.
DEFSYM	%TNODP==:2	;TTY IS A LOSING DATAPOINT.
DEFSYM	%TNIML==:3	;TTY USES IMLAC CURSOR CODES.
DEFSYM	%TNTEK==:4	;TEKTRONIX 4000 SERIES
DEFSYM	%TNTV==:5	;TTY IS A KNIGHT TV DISPLAY.
DEFSYM	%TNMEM==:6	;TTY IS A MEMOWRECK.
DEFSYM	%TNSFW==:7	;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES.
DEFSYM	%TNTRM==:10	;TTY IS A TERMINET.
DEFSYM	%TNESC==:11	;TTY WANTS ASCII STANDARD ESCAPE SEQUENCES. (E.G. VT52)
DEFSYM	%TNDTM==:12	;DATAMEDIA
DEFSYM	%TNRAY==:13	;TELERAY 1061
DEFSYM	%TNHDS==:14	;HDS CONCEPT-100
DEFSYM	%TNH19==:15	;H19
DEFSYM	%TNAAA==:16	;Ann Arbor Ambassador
DEFSYM	%TNMAX==:17


;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR
;TERMINAL ATTACHED TO EACH LINE.

;LEFT HALF BITS ARE:
DEFSYM	%TO==:1,,525252		;BIT TYPEOUT MASK
DEFSYM	%TOALT==:200000	;4.8 => STANDARDIZE ALTMODES.
DEFSYM	%TOCLC==:100000	;4.7 => CONVERT LOWER CASE TO UPPER.
DEFSYM	%TOERS==:40000	;4.6 => THIS TTY CAN SELECTIVELY ERASE.
DEFSYM	%TOHDX==:20000	;4.5 => THIS TTY IS HALF-DUPLEX.
DEFSYM	$TOHDX==:370100
DEFSYM	%TOMVB==:10000	;4.4 => THIS TTY CAN BACKSPACE.
DEFSYM	%TOSAI==:4000	;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT.
DEFSYM	%TOSA1==:2000	;4.2 INIT %TSSAI OF NEW JOBS.
DEFSYM	%TOOVR==:1000	;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY.
DEFSYM	%TOMVU==:400	;3.9 => THIS TTY CAN MOVE CURSOR UP (I.E. IT'S A
			; DISPLAY).
DEFSYM	%TOMOR==:200	;3.8 => DO **MORE** PROCESSING ON THIS TTY
			; (ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS).
DEFSYM	%TOROL==:100	;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS.
DEFSYM	%TORAW==:40	;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION.
DEFSYM	%TOLWR==:20	;3.5 => THIS TTY HAS LOWER CASE KEYBOARD.
DEFSYM	%TOFCI==:10	;3.4 => KEYBOARD CAN GENERATE FULL 12-BIT CHARACTER SET
DEFSYM	%TOIML==:4	;3.3 => SPACE, BS DON'T EQUAL ^PF, ^PB; ALSO ^PC
			; SENDS ^L.
DEFSYM	%TOLID==:2	;3.2 => %TDILP, %TDDLP WORK (INSERT AND DELETE LINES)
DEFSYM	%TOCID==:1	;3.1 => %TDICP, %TDDCP WORK
			; (INSERT AND DELETE CHARACTERS)

;RIGHT HALF:
DEFSYM	%TP==:707252		;BIT TYPEOUT MASK
DEFSYM	%TPPLF==:100000
DEFSYM	$TPPLF==:170300	;3-BIT FIELD SAYING HOW TO PAD LF.
			; 0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET.
DEFSYM	%TPPCR==:10000
DEFSYM	$TPPCR==:140300	;3-BIT FIELD SAYING HOW TO PAD CR.
			; 7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT.
			; 0 - DON'T. 1 - NORMAL. 2 - DOUBLE.
			; ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL
			; CURSOR MOTION. 
			; 4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200.
			; ON TERMINETS, 0 => NO PADDING, ELSE 1,2,3,4,5
			; ARE PADDING FOR SPEEDS 10,15,30,60,120 CPS.
DEFSYM	%TPPCW==:6	;FOR MEMO WRECK.
DEFSYM	%TPPTB==:1000
DEFSYM	$TPPTB==:110300	;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER
			; TAB.  0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING
			; CHARS NEEDED> BUT ON A DISPLAY, TABS ARE NEVER
			; PADDED AND THIS FIELD IS 1 TO USE TABS, 2 TO USE
			; ABSOLUTE CURSOR POSITIONING, 3 TO USE BOTH, 0 TO
			; USE NEITHER.
DEFSYM	%TPMTA==:400	;1.9 => HARDWARE META KEY SETS 8TH BIT
DEFSYM	%TPPRN==:200	;1.8 => INTERCHANGE () WITH [] ON INPUT
DEFSYM	%TPTEL==:100	;1.7 => HANDLE CR-LF ON INPUT AS CR, FOR TELNET
			; PROTOCOL
DEFSYM	%TPCBS==:40	;1.6 => ENABLE SPECIAL HANDLING OF CONTROL BACK
			; SLASH ON INPUT (THE "INTELLIGENT TERMINAL
			; PROTOCOL").
DEFSYM	%TP11T==:20	;1.5 => PDP-11 TV TTY. REFLECTS %TY11T.  NOT
			; SETTABLE BY USER.
DEFSYM	%TPORS==:10	;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO
			; SOMETHING.
DEFSYM	%TPRSC==:4	;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD

;DEFINE BITS WHICH ARE USER-OPTIONS
DEFSYM	%TOUSR==:%TOCLC+%TOSA1+%TOMOR+%TOROL
DEFSYM	%TPUSR==:%TPPRN+1	;THE 1 IS TO AVOID INTEFERING WITH BIT-TYPE-OUT

DEFSYM	%TQ==1,,701725	;TTY "SMARTS" BITS IN LH(TTYSMT)
DEFSYM	%TQIM1==300000	;TTY IS A PDS1
DEFSYM	%TQIM4==200000	;TTY IS A PDS4
DEFSYM	%TQP11==100000	;TTY IS A PDP11
DEFSYM	%TQMCH==700000	;4.7-4.9 MACHINE TYPE, 0 => NOTHING SPECIAL
DEFSYM	%TQGRF==1	;3.1 UNDERSTANDS GRAPHICS PROTOCOL
DEFSYM	%TQGPH==1	;3.1 UNDERSTANDS GRAPHICS PROTOCOL (OBSOLETE NAME)
DEFSYM	%TQSET==2	;3.2 HAS MULTIPLE OBJECT SETS
DEFSYM	%TQREC==4	;3.3 HAS RECTANGLE COMMANDS
DEFSYM	%TQXOR==10	;3.4 HAS XOR MODE
DEFSYM	%TQBNK==20	;3.5 HAS BLINKING
DEFSYM	%TQVIR==40	;3.6 VIRTUAL COORDINATES
DEFSYM	%TQHGT==76000	;4.2-4.6 CHARACTER HEIGHT IN DOTS
DEFSYM	%TQWID==1700	;3.7-4.1 CHARACTER WIDTH IN DOTS

DEFSYM	%TR==534052	;RH(TTYSMT)
DEFSYM	%TRGIN==400000	;2.9 HAS GRAPHIC INPUT
DEFSYM	%TRGHC==200000	;2.8 HAS GRAPHIC HARDCOPY
DEFSYM  %TRLED==100000	;2.7 HAS LOCAL EDITING PROTOCOL.
DEFSYM	%TRSCN==040000	;2.6 HAS RASTER COMMANDS
DEFSYM	%TRLSV==034000	;2.3-2.5 NONZERO MEANS TERMINAL SUPPORTS 4**N SAVED
			; LINES.
DEFSYM	%TRTIM==003700
DEFSYM	$TRTIM==060500	;5 BIT FIELD WHICH IS THE SIGNED OFFSET FROM GMT
			; MINUS #o20; A VALUE OF ZERO MEANS DON'T KNOW,
			; DON'T CARE, OR USER PROGRAM HASN'T IMPLEMENTED IT
			; YET

;GROUP NUMBER		   CHARACTERS
;[	0		^A-^F ^K-^L ^N-^R ^T-^Z ^] ^^ ^_ ^@ ^\
;	1		A-Z   LOWER CASE A-Z
;	2		0-9
;	3		!"#$(DOLLAR)%&',.:;?@\ (ACCENT GRAVE)
;			 (VERTICAL BAR) (TILDE)
;	4		*+-/=^_
;	5		<>[]() (LEFT BRACE) (RIGHT BRACE)
;	6		^G ^S
;	7		LF ^I(TAB)
;	10		(ALTMODE)
;	11		CR
;	12		RUBOUT
;	13		SPACE ^H(BACKSPACE)

;TTYST1 HAS GROUPS 0 THROUGH 5 FROM LEFT TO RIGHT
;TTYST2 HAS 6 THROUGH 13
;EACH GROUP HAS SIX BITS AS FOLLOWS:
DEFSYM	%TG==:777725		;BIT TYPEOUT MASK
DEFSYM	%TGINT==:1	;N.1 => INTERRUPT ON THIS GROUP
DEFSYM	%TGACT==:2	;N.2 => ACTIVATE ON THIS GROUP (FOR SWAPPING)
DEFSYM	%TGSPC==:4	;N.3 => SPECIAL HACKS.
			; (THIS SET ON GROUP 1 => CONVERT LOWER CASE) 
DEFSYM	%TGIMG==:10	;N.4 => IMAGE MODE OUTPUT (N.4=0  => ASCII MODE)
			;N.6-N.5 => ECHO MODE
			;	00 => NO ECHO
DEFSYM	%TGPIE==:20	;	01 => PI  ECHO (ECHO CHARACTER WHEN TYPED)
DEFSYM	%TGMPE==:40	;	10 => MAIN PROGRAM ECHO (ECHO WHEN MAIN
			;	      PROGRAM RECEIVES CHARACTER)

;TTYSTS HAS RANDOM BITS ASSOCIATED WITH THE TELETYPE
DEFSYM	%TS==:1,,525252		;BIT TYPEOUT MASK
DEFSYM	%TSFRE==:400000	;4.9 => TTY FREE
DEFSYM	%TSCLE==:200000	;4.8 => ECHO ^L AS UPARROW-L EVEN ON DISPLAYS
			;(OTHERWISE WOULD ECHO AS CLEAR SCREEN)
DEFSYM	%TSHDX==:100000	;4.7 REFLECTS %TOHDX BIT.
DEFSYM	%TSFCO==:040000	;4.6 => HANDLE 9-BIT CHARS ON OUTPUT, USING ALPHA,
			; BETA, EPSILON.
DEFSYM	%TSALT==:020000	;4.5 => DON'T STANDARDIZE ALTMODE.
DEFSYM	%TSROL==:010000	;4.4 => SCROLL MODE.
DEFSYM	%TSSAI==:004000	;4.3 => ECHO AND ASCII MODE SHOULD USE SAIL CHAR SET.
DEFSYM	%TSACT==:002000	;4.2 => GOBBLE NEXT CHAR REGARDLESS OF ACTIVATION
			; STATUS
DEFSYM	%TSNEA==:001000	;4.1 => DON'T ECHO IN ECHO AREA; ECHO IN M.P. AREA
DEFSYM	%TSINT==:000400	;3.9 => INT ON NEXT CHAR REGARDLESS
DEFSYM	%TSMOR==:000200	;3.8 => INHIBIT **MORE**.
DEFSYM	%TSATY==:000100	;3.7 SET BY .ATTY, SAYS TTY WAS TAKEN AWAY & RETURNED.
			;3.6-3.5 UNUSED.
DEFSYM	%TSNOE==:000010	;3.4 => DEFER ECHOING, AND MAKE INPUT IOT'S ACT AS
			; IF %TIECH=1.
DEFSYM	%TSLCZ==:000004	;3.3 => LAST CHARACTER TYPED WAS ^Z
			; (NOT PRECEEDED BY ^_)
DEFSYM	%TSSII==:000002	;3.2 => SUPER IMAGE INPUT MODE.  ^Z AND ^_ INHIBITED.
DEFSYM	%TSCNS==:000001	;3.1 => TTY IN USE AS CONSOLE CONTROLLING A TREE.
DEFSYM	$TSCNS==:220100
			;RH => USER INDEX
			;	-1 => NO USER

;TTYCOM VARIABLE.
;4.9 => TTY IN COMMUNICATE MODE
DEFSYM	%TC==:1,,525252		;BIT TYPEOUT MASK
DEFSYM	%TCLFT==:200000	;4.8 => LOCAL FEED THROUGH (SET IF MY PRGM
			; RECEIVING HIS CHRS)
DEFSYM	%TCRFT==:100000	;4.7 => REMOTE FEED THROUGH (SET IF HIS PRGM
			; RECEIVING MY CHRS)
DEFSYM	%TCICO==:40000	;4.6 => INPUT COMMUNICATE OVERRIDE (SET IF MY
			; CONSOLE FEEDING MY PRGM EVEN THO IN COMM MODE).
			; ALSO IMPLIES OUTPUT OVER-RIDE
DEFSYM	%TCOCO==:20000	;4.5 => OUTPUT COMMUNICATE OVERRIDE (SET IF MY
			; PRGM'S OUTPUT TO APPEAR ON MY CONSOLE ONLY EVEN
			; THO IN COM MODE)
			;4.4-4.3 => MESSAGE RECEIPT SWITCH
			;  00 => ACCEPT
DEFSYM	%TCRFS==:10000	;  10 => REFUSE
DEFSYM	%TCQRY==:4000	;  01 => INTERROGATE
DEFSYM	%TCMTR==:2000	;4.2  SET FOR TTY WHOSE MOTOR IS OFF & MUST BE
			; TURNED ON BEFORE ANY OTHER OUTPUT IS DONE.  (ONLY
			; TERMINETS HAVE THEIR MOTORS SHUT OFF BY ITS).
DEFSYM	%TCECH==:1000	;4.1 THE OUTPUT BUFFER CONTAINS ECHOING OUTPUT.
			; THIS MAKES OUTPUT RESET DO NOTHING.  THE BUFFER
			; MUST NOT CONTAIN ECHO OUTPUT AND NORMAL OUTPUT AT
			; ONE TIME.
DEFSYM	%TCLED==:400	;3.9 JOB WHICH OWNS TTY WANTS LOCAL EDITING IN
			; TERMINAL.  SET BY CTL BIT 1.1 IN SCPOS; CLEARED
			; BY SWITCHING JOBS.
DEFSYM	%TCDET==:200	;3.8 CONSOLE'S TREE DETACHED BY TOP LEVEL
			; INTERRUPT.  SET BY NDETAC AS SIGNAL TO SYSCFM
			; (CNSL-FREE-MSG TYPER)
DEFSYM	%TCDNG==:100	;3.7 => TYPE BELL ON TTY (BECAUSE INPUT BFR FULL).
DEFSYM	%TCCBK==:40	;3.6 => READING UNAME OR TTY # AFTER ^_K.
DEFSYM	%TCCBS==:20	;3.5 => READING UNAME OR TTY # AFTER ^_S.
DEFSYM	%TCFPD==:10	;3.4 => FIRST PART OF MULTI-CHAR OUTPUT SEQUENCE DONE.
DEFSYM	%TCTPN==:4	;3.3 TYPE ^_N ON LEAVING COM MODE (UNLESS USER
			; EXPLICITLY TYPES ^_N)
DEFSYM	%TCPAD==:2	;3.2  0 => PADDING NECESSARY ON DATAPOINT.
DEFSYM	%TCHNG==:1	;3.1 TTY'S DONE FLAG APPEARS TO BE FRIED, TIME OUT
			; QUICKLY
;RH => USER INDEX COMMUNICATING WITH (-1 NONE)

;TTYTYP TABLE
;THIS TABLE HOLDS BITS THAT DESCRIBE THE LINE
;AND ITS CONTROLLER, RATHER THAN THE TTY ATTACHED TO THE LINE.
DEFSYM	%TT==:1,,525360		;BIT TYPEOUT MASK
DEFSYM	%TTLCL==:400000	;BIT 4.9 ONE => LOCAL TTY
DEFSYM	%TT340==:200000	;BIT 4.8 ONE => CONSOLE NEXT TO 340 OR A 340 SLAVE
DEFSYM	%TT3HP==:100000	;BIT 4.7 HIGH PRIORITY ON 340
DEFSYM	%TTPAR==:004000	;BIT 4.3
DEFSYM	%TTDDI==:002000	;BIT 4.2 DONT DING ON EXCESS INPUT
DEFSYM	$TTISP==:260400	;3.8-3.5 INPUT SPEED CODE
DEFSYM	%TTISP==:20
DEFSYM	$TTOSP==:220400	;3.4-3.1 OUTPUT SPEED CODE
DEFSYM	%TTOSP==:1
;RIGHT HALF BITS
DEFSYM	%TY==:525252		;BIT TYPEOUT MASK
DEFSYM	%TYDPK==:400000	;BIT 2.9 (DATAPOINT KLUDGE TTY LINE)
DEFSYM	%TYSTY==:200000	;BIT 2.8 PSEUDO TTY
DEFSYM	%TYNVA==:100000	;BIT 2.7 NOVA TTY
DEFSYM	%TYMTY==:040000	;BIT 2.6 MORTON BOX
DEFSYM	%TYDIL==:020000	;BIT 2.5 DIAL UP
DEFSYM	%TY11T==:010000	;BIT 2.4 PDP-11 TV TTY.
DEFSYM	%TYDL==:004000	;BIT 2.3 DL-11 TTY
DEFSYM	%TYOTY==:002000	;BIT 2.2 KA-10 CONSOLE TTY
DEFSYM	%TYETY==:001000	;BIT 2.1 DTE20 TTY
DEFSYM	%TYNTY==:000400	;BIT 1.9 TK-10 TTY
DEFSYM	%TYMDM==:000200	;BIT 1.8 LINE DETECTS DIALINS AND HANGUPS
DEFSYM	%TYKST==:000100	;BIT 1.7 KS-10 CONSOLE TTY
DEFSYM	%TYDZT==:000040	;BIT 1.6 DZ-11 TTY ON KS-10
DEFSYM	%TYRLM==:000020	;BIT 1.5 ROLM DATA SWITCH

;SPEED CODES ARE DOCUMENTED ON PAGE 3 OF ITS (DEFINE SPEED1)

;SUPDUP GRAPHICS PROTOCOL COMMANDS:

DEFSYM	%GO==:,,-1

DEFSYM  %GODLR==:101	;<p>  Draw line relative, from the cursor to <p>.
DEFSYM  %GODPR==:102	;<p>  Draw point relative, at <p>.
DEFSYM  %GODRR==:103	;<p>  Draw rectangle relative, corners at <p> and
			;     at the current cursor position.
DEFSYM	%GODCH==:104	;<string> <0>
			;Display the chars of <string> starting at the current
			;graphics cursor position.
DEFSYM	%GODSC==:105	;<scan bits> <terminater> Draws scan bits starting at
			;the current gaphics cursor position. <scan bits> come
			;in bits of 6-6-4. <terminater> has 100 bit (character
			;gobbled) or 200 bit (interpreted as %TD code) set.
DEFSYM	%GODRN==:106	;<run bits> <0> Draw run length encoded raster line
			;starting at current graphic cursor. Low six bits are
			;count. 100 bit determines point type (on/off).

DEFSYM	%GODLA==:121	;<p>  Draw line absolute, from the cursor to <p>.
			;     The same effect as %GODLR, but the arg absolute.
DEFSYM	%GODPA==:122	;<p>  Draw point absolute, at <p>.
DEFSYM	%GODRA==:123	;<p>  Draw rectangle absolute, corners at <p> and
			;     at the current cursor position.

DEFSYM	%GOELR==:141	;<p>  Erase line relative, from the cursor to <p>.
DEFSYM	%GOEPR==:142	;<p>  Erase point relative, at <p>.
DEFSYM	%GOERR==:143	;<p>  Erase rectangle relative, corners at <p> and
			;     at the current cursor position.
DEFSYM	%GOECH==:144	;<string> <0>
			;Erase the chars of <string> starting at the current
			;graphics cursor position.
DEFSYM	%GOESC==:145	;<scan bits> <terminater>. Erase scan bits starting at
			;the current graphics cursor position. 
DEFSYM	%GOERN==:146	;<run bits> <0> Erase run-length encoded rasters
			;starting at current grphaics cursor position. 

DEFSYM	%GOELA==:161	;<p>  Erase line absolute, from the cursor to <p>.
DEFSYM	%GOEPA==:162	;<p>  Erase point absolute, at <p>.
DEFSYM	%GOERA==:163	;<p>  Erase rectangle absolute, corners at <p> and
			;     at the current cursor position.

DEFSYM	%GOMVR==:001	;<p>  Move cursor to point <p>
DEFSYM	%GOMVA==:021	;<p>  Move cursor to point <p>, absolute address.
DEFSYM	%GOXOR==:002	;     Turn on XOR mode.  Bit matrix terminals only.
DEFSYM	%GOIOR==:022	;     Turn off XOR mode.
DEFSYM	%GOSET==:003	;<n>  Select set.  <n> is a 1-character set number,
			;     0 - 177.
DEFSYM	%GOMSR==:004	;<p>  Move set origin to <p>.  Display list
			;     terminals only.
DEFSYM	%GOMSA==:024	;<p>  Move set origin to <p>, absolute address.
DEFSYM	%GOINV==:006	;     Make current set invisible.
DEFSYM	%GOVIS==:026	;     Make current set visible.
DEFSYM	%GOBNK==:007	;     Make current set blink.  Canceled by %GOINV
			;     or %GOVIS.
DEFSYM	%GOCLR==:010	;     Erase whole screen.
DEFSYM	%GOCLS==:030	;     Erase entire current set (display list
			;     terminals).
DEFSYM	%GOPSH==:011	;     Push all input-stream status information, to be
			;     restored when graphics mode is exited.
DEFSYM	%GOVIR==:012	;     Start using virtual co-ordinates
DEFSYM	%GOPHY==:032	;     Resume giving co-ordinates in units of dots.
DEFSYM	%GOHRD==:013	;<n>  Divert output to output subdevice <n>.
			;     <n>=0 reselects the main display screen.
DEFSYM	%GOGIN==:014	;<n>  Request graphics input (mouse, tablet, etc).
			;     <n> is the reply code to include in the answer.
DEFSYM	%GOLMT==:015	;<p1> <p2>
			;Limits graphics to a subrectangle of the
			;screen.  %GOCLR will clear only that area.
			;This is for those who would use the rest for text.

;THE TTYTBL VARIABLE EXISTS FOR EACH JOB.
;IT DESCRIBES THE ATTY-DTTY STATE OF THE JOB
;AND OTHER THINGS THAT HAVE TO DO WITH THE TREE'S
;CONTROLLING TTY ONLY.
DEFSYM	%TB==:1,,525277		;BIT TYPEOUT MASK
DEFSYM	%TBNOT==:400000	;4.9 THIS JOB DOES NOT HAVE THE TTY NOW.
DEFSYM	%TBNVR==:200000	;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL.
DEFSYM	%TBINT==:100000	;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY
			; SHOULD INTERRUPT.
DEFSYM	%TBWAT==:040000	;4.6 IF SET, OVERRIDES %TBINT AND %TBNVR, AND
			; FORCES TTY USAGE ATTEMPTS TO HANG. MAY BE ALTERED
			; ONLY BY SUPERIOR.
DEFSYM	%TBDTY==:010000	;4.4 THE JOB DOESN'T HAVE THE TTY, BUT IT IS IN A
			; DTTY'ING STATE. IN OTHER WORDS, THIS JOB DOESN'T
			; WANT TO GIVE THE TTY TO ONE OF ITS INFERIORS.
DEFSYM	%TBOUT==:004000	;4.3 ALLOW TYPEOUT EVEN IF DON'T HAVE TTY (SETTABLE
			; BY SUPERIOR)
DEFSYM	%TBINF==:002000	;4.2 ALLOW INFERIORS TO TAKE ADVANTAGE OF THEIR
			; %TBOUTS.
DEFSYM	%TBOIG==:001000	;4.1 IGNORE OUTPUT (NORMALLY SET BY SUPERIOR).
			; OVERRIDES %TBWAT, %TBINT.
DEFSYM	%TBIIN==:000400	;3.9 INTERRUPT ON ATTEMPT TO DO INPUT.  OVERRIDES
			; %TBWAT.  NORMALLY SET BY SUPERIOR.
DEFSYM	$TBECL==:220600	;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY
DEFSYM	%TBECL==:77

;RH - IF %TBNOT IS 0, THE RH HAS THE TTY NUMBER.
;OTHERWISE, IF %TBDTY IS 0, THE RH HAS THE USR INDEX OF
;THE INFERIOR THAT THIS JOB GAVE OR WOULD LIKE TO GIVE
;THE TTY TO. OTHERWISE, THE RH IS 0.

;BITS IN THE PER-STY VARIABLE STYSTS, RETURNED BY STYGET SYSTEM CALL.
DEFSYM	%SS==:1,,525252			;BIT TYPEOUT MASK
DEFSYM	%SSHNG==:400000		;4.9 = 1 => DON'T HANG ON INPUT IOTS
DEFSYM	%SSUSE==:200000		;4.8 = 1 => IN USE
DEFSYM	%SSINT==:100000		;4.7 = 1 => HAVE GIVEN INT ON STY OUTPUT
				; CHNS ALREADY
DEFSYM	%SSONT==:040000		;4.6 = 1 => DITTO FOR STY INPUT (TTY OUTPUT)
DEFSYM	%SSOHG==:20000		;4.5 = 1 => DON'T HANG ON OUTPUT IOT
				;RH = USER INDEX THAT HAS IT OPEN


IFN $$TEMP, EXPUNGE DEFSYM
